<template>
	<view class="page">
		<z-paging ref="paging">
			<uv-navbar slot="top" autoBack :fixed="true" title=" " placeholder></uv-navbar>

			<!-- 内容 -->
			<view class="contnet ios">
				<view class="title">{{title}}</view>
				<view class="notice-time">{{created_at}}</view>
				<view class="rich-text" v-html="introduction"></view>
			</view>

		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				created_at: '',
				introduction: '',
			}
		},
		onLoad(e) {
			console.log(e);
			this.getData(e.id)
		},
		methods: {
			getData(id) {
				this.$Api.wxGetConfigDetails({
					id
				}).then(res => {
					console.log(res);
					if (res.code == 200) {
						this.title = res.data.title
						this.created_at = res.data.created_at
						const regex = new RegExp('img', 'gi');
						res.data.content = res.data.content.replace(regex,
							`img style="max-width:100%;object-fit: cover;"`);
						res.data.content = res.data.content.replace(/<p>/g, '<p style="margin: 16px 0px;">');
						this.introduction = res.data.content;

					}
				}).catch((err) => {});
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "info.scss";
</style>